import { TableColumn } from "@/components/GuatTable/types";
import { Tag } from "@arco-design/web-vue";
import { Api, Status } from "@/map/point/index";

const { GetMemberPointChangeMap: M } = Api;
const { PointChangeType: T } = Status;

export const createTableColumns = (): TableColumn[] => [
  {
    title: "变更时间",
    dataIndex: M.ChangeTime,
  },
  {
    title: "变更类型",
    render: (record) => {
      const isAdd = record[M.ChangeType][M.ChangeTypeId] == T.INC;
      return <Tag color={isAdd ? "blue" : "red"}>{record[M.ChangeType][M.ChangeTypeText]}</Tag>;
    },
  },
  {
    title: "分值",
    dataIndex: M.ChangePoint,
  },
  {
    title: "积分类型",
    render: (record) => {
      return <>{record[M.PointType][M.PointTypeName]}</>;
    },
  },
  {
    title: "操作人",
    render: (record) => {
      return <>{record[M.Operator][M.OperaterName]}</>;
    },
  },
];
